package io.renren.modules.member.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.renren.modules.member.dao.TStoreMemberRechargeRecordDao;
import io.renren.modules.member.entity.TStoreMemberRechargeRecordEntity;
import io.renren.modules.member.entity.vo.MemberRechargeRecordVo;
import io.renren.modules.member.service.TStoreMemberRechargeRecordService;
import io.renren.modules.store.entity.vo.FoodDiscountVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;


@Service("tStoreMemberRechargeRecordService")
public class TStoreMemberRechargeRecordServiceImpl extends ServiceImpl<TStoreMemberRechargeRecordDao, TStoreMemberRechargeRecordEntity> implements TStoreMemberRechargeRecordService {

    @Autowired
    private TStoreMemberRechargeRecordDao rechargeRecordDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TStoreMemberRechargeRecordEntity> page = this.page(
                new Query<TStoreMemberRechargeRecordEntity>().getPage(params),
                new QueryWrapper<TStoreMemberRechargeRecordEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public Page<MemberRechargeRecordVo> listRechargeRecords(Map<String, Object> params) {
        Page<MemberRechargeRecordVo> page = new Page<MemberRechargeRecordVo>
                (Long.parseLong((String) params.get("current")),Long.parseLong((String) params.get("size")));
        return rechargeRecordDao.listRechargeRecords(page,params);
    }

    @Override
    public Double memberRechargeMoney(Map<String, Object> map) {
        return rechargeRecordDao.memberRechargeMoney(map);
    }

}